package com.demo.steammanagement.config.response;

import com.demo.steammanagement.model.vo.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 全局捕获业务异常，返回给前端
 */
@ControllerAdvice
public class ResponseController {

    @ExceptionHandler(value = BizException.class)
    @ResponseBody
    public Result bizException(BizException e) {
        return Result.fail(400,e.getMessage());
    }
}
